/**
 * 页面定制公共js
 */

import PublicApi from "@/api/public.js"

export default {
    props: {
        config:{
            type:Object,
            default:{}
        },
        paramsCustom:{
            type:Object,
            default:()=>{
                return {}
            }
        }
    },
    data() {
        return {}
    },
    created() {
    },
    methods: {
        //获取路由传递的参数
        getRouterParams(){
            return this.paramsCustom;
        },
        //根据配置获取参数
        getParams(mapping,callback){
            PublicApi.getParams(JSON.stringify(mapping)).then(res=>{
                if(callback){
                    callback(res);
                }
            }).catch(err=>{
                if(callback){
                    callback({});
                }
            })
        },
        getImage(url) {
            return import.meta.env.JPAAS_BASE_URL + url;
        },
    }
}
